import request from '@/utils/request'

// 查询产品列表
export function listProduct(query) {
  return request({
    url: '/function/product/list',
    method: 'get',
    params: query
  })
}


// 查询产品详情
export function getProduct(id) {
  return request({
    url: '/function/product/' + id,
    method: 'get'
  })
}

// 新增产品
export function addProduct(data) {
  return request({
    url: '/function/product',
    method: 'post',
    data: data
  })
}

// 修改产品
export function updateProduct(data) {
  return request({
    url: '/function/product',
    method: 'put',
    data: data
  })
}

// 删除产品
export function delProduct(id) {
  return request({
    url: '/function/product/' + id,
    method: 'delete'
  })
}

// 查询大类
export function listOne(query) {
  return request({
    url: '/product/category/tabulation',
    method: 'get',
    params: query
  })
}

// 查询小类
export function listTwo(query) {
  return request({
    url: '/product/type/tabulation',
    method: 'get',
    params: query
  })
}
// 查询小类不分页
export function listTwoNoPage(query) {
  return request({
    url: '/product/type/pagination',
    method: 'get',
    params: query
  })
}
// 新增大类
export function addOne(data) {
  return request({
    url: '/product/category',
    method: 'post',
    data: data
  })
}
// 新增小类
export function addTwo(data) {
  return request({
    url: '/product/type',
    method: 'post',
    data: data
  })
}
// 修改大类
export function updateOne(data) {
  return request({
    url: '/product/category',
    method: 'put',
    data: data
  })
}
// 修改小类
export function updateTwo(data) {
  return request({
    url: '/product/type',
    method: 'put',
    data: data
  })
}
// 删除大类
export function delOne(id) {
  return request({
    url: '/product/category/delete/' + id,
    method: 'delete'
  })
}
// 删除小类
export function delTwo(id) {
  return request({
    url: '/product/type/' + id,
    method: 'delete'
  })
}
// 导出产品模板
export function exportP() {
  return request({
    url: '/function/product/export/template',
    method: 'get'
  })
}
// 导入产品
export function importP(data) {
  return request({
    url: '/function/product/importData',
    method: 'post',
    data: data
  })
}